Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

help with fixing a script that detects when a player presses e on a part?

in a game i am trying to create i want to fire a function when a player is on a specific part however the two bits of code i am using work fine on there own but when i put them together it breaks can any tell me what i am doing wrong please

here is my code:

local player = game.Players.LocalPlayer local mouse = player:GetMouse()

Music = script.Sound

script.Parent.Touched:connect(function(hit)

   mouse.KeyDown:connect(function(key)
	   if key == "e" then
		   print("test")
       end
   end)

end)

1 answer

mouse.KeyDown is deprecated use UserInputService instead

and it's Connect with capital C

1 comment

0

isnt UserinputService for local scripts?

This discussion is preserved as it was. New answers, comments, and votes are closed.