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

Should this code be a LocalScript and be placed into StarterGui?

Should this code be a LocalScript and be placed into StarterGui?

 local player = game.Players.LocalPlayer
 local character = player.Character
 local rep = game:GetService("ReplicatedStorage")
 local uis = game:GetService("UserInputService")
 local jumpshot = rep.Animations:WaitForChild("jumpshot animation")
 local jumpshotanimation = character.Humanoid:LoadAnimation(jumpshot)
 local shoot = rep.Events:WaitForChild("shoot")
 local Basketball = game.ServerStorage.PracticeBall
 local ShotBall = false
 local Debounce = false
 uis.InputBegan:Connect(function(input)
     if input.KeyCode == Enum.KeyCode.E and not Debounce and not ShotBall and 
 character.Humanoid:FindFirstChild(Basketball) then	
	     ShotBall = true	
	     Debounce = false	
	     jumpshotanimation:Play()
	     wait()
 		 Debounce = false
	     ShotBall = false
	     shoot:FireServer()
      end
 end)

1 comment

0

I'm still accepting answers! D:

1 answer

✓ Accepted answer

Yes, it should be put in a local script since it is detecting the player's input. I'd put the script in local character scripts since it requires the character to be loaded to run.

3 comments

0

Okay.

0

i will acctually set local scripts in starterGUI

0

Okay.

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