robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
|
| 10 Aug 2017 09:03 PM |
| how do i do a script with a players name without having to put the players name in it like this game.Workspace.Elevator1button1script.OnServerEvent:Connect(function() game.workspace.(players name).HumanoidRootPart.CFrame = ################## ######## -93.8) end) spamming until my account gets terminated |
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
|
| 10 Aug 2017 09:04 PM |
im trying to make the (players name) insert the players name without actually having to type in the players name idk how to do this
|
|
|
| Report Abuse |
|
|
HeIix
|
  |
| Joined: 19 Jan 2013 |
| Total Posts: 253 |
|
|
| 10 Aug 2017 09:16 PM |
If its server-sided, use
game.Players.PlayerAdded:connect(function(player) --code here using player end)
If your script is client-sided, just use
game.Players.LocalPlayer
--code
|
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
|
| 10 Aug 2017 09:21 PM |
im not sure if its server sided or client sided. whats the difference?
|
|
|
| Report Abuse |
|
|
HeIix
|
  |
| Joined: 19 Jan 2013 |
| Total Posts: 253 |
|
|
| 10 Aug 2017 09:22 PM |
Server-sided (regular scripts) run on roblox's hosting computers, the go-between for all clients.
Client-sided (localscripts) run on each player's own computer.
|
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
|
| 10 Aug 2017 09:29 PM |
game.Workspace.Elevator1button1script.OnServerEvent:Connect(function() game.Players.PlayerAdded:connect(function(player) player.HumanoidRootPart.CFrame = CFrame.new() end) end)
|
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
HeIix
|
  |
| Joined: 19 Jan 2013 |
| Total Posts: 253 |
|
|
| 10 Aug 2017 09:32 PM |
What exactly are you trying to do with it?
|
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
|
| 10 Aug 2017 09:33 PM |
so i have a button that when you click it it will teleport you to somewhere but im not sure how to make this work
|
|
|
| Report Abuse |
|
|
|
| 10 Aug 2017 09:33 PM |
game.Players.PlayerAdded:connect(function(player) player.HumanoidRootPart.CFrame = CFrame.new() end)
I don't know if you need the first function. Also, I'm not familiar with HumanoidRootPart, if that in the actual player or is it in the workspace? If it's in the workspace you would have to do human = game.Workspace:findFirstChild(player.Name) then do that
|
|
|
| Report Abuse |
|
|
HeIix
|
  |
| Joined: 19 Jan 2013 |
| Total Posts: 253 |
|
|
| 10 Aug 2017 09:38 PM |
Its a gui button?
If you're firing a remoteEvent to the server, the first argument is always the player's name.
game.Workspace.Elevator1button1script.OnServerEvent:Connect(function(player) player.Character.HumanoidRootPart.CFrame = CFrame.new() end)
Assuming "Elevatorbutton1script" is your remoteEvent
For a future note, you generally want to put remoteEvents into ReplicatedStorage, not workspace
|
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
|
| 11 Aug 2017 01:29 AM |
@Maliciously_Intended
i think you were right about the humanoidRootPart, but im not sure what to do with the script you gave me. can someone please explain?
|
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
|
| 11 Aug 2017 02:59 AM |
function ButtonClicked() Player.Character:MoveTo() end
script.Parent.MouseButton1Click:connect(ButtonClicked) |
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
|
| 11 Aug 2017 02:56 PM |
i tried that and it says this
Unable to cast Instance to Vector3
in the output
|
|
|
| Report Abuse |
|
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|
robinglox
|
  |
| Joined: 10 Nov 2014 |
| Total Posts: 223 |
|
| |
|