generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Insert a script into a specific two player names

Previous Thread :: Next Thread 
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:23 PM
local k = Instance.new("Script", game.workspace)
k.parent = game.Workspace:FindFirstChild("Post12346", "Player")
k.name = "SprintScript"
k.text = (local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end


mouse.KeyDown:connect(function (key) -- Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
end
end))

I have been trying to get this to work, it will insert a shift to sprint script on wither my username or on Studio's "Player"



If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:24 PM
I have been trying to get this to work, it will insert a shift to sprint script on either my username or on Studio's "Player"



If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
18 May 2015 03:25 PM
Don't use KeyDown, use UserInputService.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
18 May 2015 03:26 PM
You're using :FindFirstChild() wrong. Use tables instead:

local Players = {"Post12346", "Player"}

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:26 PM
Could you give me the line numbers like "(lines 3-5)" and what to change the script to?



If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
18 May 2015 03:27 PM
local k = Instance.new("Script", game.workspace)
k1 = k:Clone()
k.parent = game.Workspace:FindFirstChild("Player")
k1.parent = game.Workspace:FindFirstChild("Post123456")
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
18 May 2015 03:27 PM
Did you make the script?

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784

Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:28 PM
The sprint script it's-self isn't mine, the rest is
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
18 May 2015 03:28 PM
You are doing this wrong.

Store the keydown stuff in a script, put that in serverstorage and disable it.

in another script in workspace:
when a player enters the game, clone that script into the player, enable the script.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
18 May 2015 03:29 PM
just put the shift-to-sprint script inside of serverstorage, and clone it to any new players with a specific name

local scriptToClone = path to your script yo

local peeps = {"Player", "Post123456"}

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
for i, peep in pairs(peeps) do
if peep == char.Name then
scriptToClone:Clone().Parent = plr.Backpack
end
end
end)
end)
Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:30 PM
My main thing is, it's a contest between me and my brother. We're making something that is an all-in-one script w/ no children that will only work on our own player and Studio's "Player" player



If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
18 May 2015 03:30 PM
Really.. Cloning it?

Extra Scripts = Less Efficiency.

I love efficiency... Just check if the player is in the table and then if they are let them sprint.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
18 May 2015 03:31 PM
@Insta please use "scriptClone" not scriptToClone...that just annoys me....but obv. you could just b like

local sc = script:Clone()
Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:32 PM
The sprint script is actually meant to be placed in game.Workspace.Player

I'm still waiting for a list of what line numbers are to be edited and what they're changed to.



If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
18 May 2015 03:32 PM
local script_12 = ur script path

local players = {"Player" = true, "Post123456" = true}

game.Players.PlayerAdded:connect(function(plr)
if players[plr.Name] then
script_12:Clone().Parent = plr.Backpack
end
end)
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
18 May 2015 03:33 PM
i don't see what is so inefficient about cloning it to only two possible players.
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
18 May 2015 03:34 PM
does the backpack reset on spawn? if so then use the other guy's
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
18 May 2015 03:34 PM
backpack and playergui is indeed cleared on death
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
18 May 2015 03:35 PM
@Insta

It isn't the biggest difference, but it's a difference that can be easily avoided.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:36 PM
Okay, For one, DO NOT MENTION BACKPACK.

It is inserting a script into the workspace player. That is what contains the torso, arms, legs, head, packages, hats.

Second: I think I understood some of it, don't know what UserInputService does tho.


local k = Instance.new("Script", game.workspace)
local Players = {"Post12346", "Player"}
k.name = "SprintScript"
k.parent = Players
k.text = (local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end


mouse.KeyDown:connect(function (key) -- Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
end
end))







If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
18 May 2015 03:36 PM
@power

the only other alternative i see is to have the local script check if the player is one of those names, but then you would need to have it distributed to every single player via the starterpack/startergui

and that's more inefficient

Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:37 PM
Also, it has to be a localscript with that name, don't know how to do that part either.
Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:38 PM
Okay, I think I figured it out, lets try it.




local k = Instance.new("localScript", game.workspace)
local Players = {"Post12346", "Player"}
k.name = "SprintScript"
k.parent = Players
k.text = (local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end


mouse.KeyDown:connect(function (key) -- Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
end
end))







If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
18 May 2015 03:39 PM
@Insta

I'm so dumb... I skimmed through his script and thought he was using .PlayerAdded... :/
Wow, I was caught up in the excitement of being advanced... :/

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Post12346 is not online. Post12346
Joined: 21 May 2011
Total Posts: 323
18 May 2015 03:40 PM
local k = Instance.new("localScript", game.workspace)
local Players = {"Post12346", "Player"}
k.name = "SprintScript"
k.parent = Players
k.text = (local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end


mouse.KeyDown:connect(function (key) -- Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 30
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
end
end))



Tested and broken... Any help here?



If FE is Iron on the periodic scale, then FEmale must be Iron Man! :D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image