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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: how to do this

Previous Thread :: Next Thread 
robinglox is online. 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 is online. 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 is not online. 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 is online. 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 is not online. 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 is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
10 Aug 2017 09:23 PM
ok i got it. thanks


Report Abuse
robinglox is online. 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 is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
10 Aug 2017 09:31 PM
would that work?


Report Abuse
HeIix is not online. 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 is online. 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
Maliciously_Intended is not online. Maliciously_Intended
Joined: 20 May 2011
Total Posts: 975
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 is not online. 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 is online. 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 is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
11 Aug 2017 01:58 AM
bump


Report Abuse
NathanDingy is not online. NathanDingy
Joined: 01 Dec 2008
Total Posts: 72
11 Aug 2017 02:59 AM
function ButtonClicked()
Player.Character:MoveTo()
end

script.Parent.MouseButton1Click:connect(ButtonClicked)
Report Abuse
robinglox is online. 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 is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
11 Aug 2017 03:13 PM
bump


Report Abuse
robinglox is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
11 Aug 2017 04:11 PM
bump2


Report Abuse
robinglox is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
11 Aug 2017 06:04 PM
bump3


Report Abuse
robinglox is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
11 Aug 2017 06:51 PM
bump4


Report Abuse
robinglox is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
11 Aug 2017 07:05 PM
bump5


Report Abuse
robinglox is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
11 Aug 2017 07:35 PM
please im desperate


Report Abuse
robinglox is online. robinglox
Joined: 10 Nov 2014
Total Posts: 223
12 Aug 2017 12:04 AM
bump7


#Rep
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