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 » Scripting Helpers
Home Search
 

Re: Controller service

Previous Thread :: Next Thread 
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 04:54 PM
Im trying to make the player unable to walk while the tool is selected, without setting their walkspeed to 0, or anchoring their parts.

This works, but if they are walking when they select the tool, they just keep walking

Tool = script.Parent
GameGui = Tool.TetrisGui

Tool.Equipped:connect(function(Mouse)
Game:GetService("ControllerService"):ClearAllChildren()
Mouse.Button1Down:connect(function()

if not Game.Players.LocalPlayer.PlayerGui:FindFirstChild("TetrisGui") then
StartingGame = GameGui:Clone()
StartingGame.Parent = Game.Players.LocalPlayer.PlayerGui
StartingGame.TetrisScript.Disabled = false
end

end)
end)

Tool.Unequipped:connect(function(Mouse)
Instance.new("HumanoidController", Game:GetService("ControllerService"))

if Game.Players.LocalPlayer.PlayerGui:FindFirstChild("TetrisGui") then
Game.Players.LocalPlayer.PlayerGui.TetrisGui:Destroy()
end

end)
Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
31 Aug 2013 05:00 PM
Try placing this after the controller is removed:

local p = game.Players.LocalPlayer.Character.Torso.Position
game.Players.LocalPlayer.Character.Humanoid:WalkToPoint(p)
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:01 PM
That is a really smart idea, I'll try it, thank you!
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:05 PM
qq
17:05:23.148 - Players.Player1.Backpack.Tetris.StartScript:7: attempt to call method 'WalkToPoint' (a userdata value)
17:05:23.156 - Script 'Players.Player1.Backpack.Tetris.StartScript', Line 7
17:05:23.158 - stack end
17:05:23.159 - Disconnected event because of exception


Tool = script.Parent
GameGui = Tool.TetrisGui
Player = Game.Players.LocalPlayer

Tool.Equipped:connect(function(Mouse)
Game:GetService("ControllerService"):ClearAllChildren()
Player.Character.Humanoid:WalkToPoint(Player.Character.Torso.Position)

Mouse.Button1Down:connect(function()

if not Player.PlayerGui:FindFirstChild("TetrisGui") then
StartingGame = GameGui:Clone()
StartingGame.Parent = Player.PlayerGui
StartingGame.TetrisScript.Disabled = false
end

end)
end)

Tool.Unequipped:connect(function(Mouse)
Instance.new("HumanoidController", Game:GetService("ControllerService"))

if Player.PlayerGui:FindFirstChild("TetrisGui") then
Player.PlayerGui.TetrisGui:Destroy()
end

end)




Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
31 Aug 2013 05:07 PM
WHOOPS. That is NOT a callable thing.
Try:

Player.Character.Humanoid.WalkToPoint = Player.Character.Torso.Position
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:09 PM
Oh thanks xP
But it doesn't work >.< I'll try setting it to nil maybe?
Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
31 Aug 2013 05:10 PM
Or you could try setting their WS to 0
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:11 PM
"Im trying to make the player unable to walk while the tool is selected, without setting their walkspeed to 0, or anchoring their parts."
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
31 Aug 2013 05:12 PM
Use :MoveTo()
Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
31 Aug 2013 05:12 PM
I'm bad at reading, but I can kinda see how that works

The humanoid's wonky, but I think that there's something in the wiki that waits until no Keyboard input is detected before it removes controller
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:15 PM
Well I need for them the stop where they are and not be able to move while the tool is selected, so I can't just wait for no keyboard input

@Zack
I tried, it errored
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
31 Aug 2013 05:15 PM
Using :MoveTo() on the humanoid requires the use of the second argument.
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:16 PM
Can you give me a example?

Player.Character.Humanoid:MoveTo(Player.Character.Torso.Position, ???)
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:32 PM
Player.Character.Humanoid:MoveTo(Player.Character.Torso.Position, Player.Character.Torso)

Still doesn't work though
Report Abuse
bohdan77 is not online. bohdan77
Joined: 10 Aug 2008
Total Posts: 7944
31 Aug 2013 05:47 PM
Just make sure no keys are being pressed, and just wait until none are.
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
31 Aug 2013 05:50 PM
Then they could select the tool and be moving
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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