Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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)
0
I'm still accepting answers! D: robloxtitanic584 92 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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.

0
Okay. robloxtitanic584 92 — 3y
0
i will acctually set local scripts in starterGUI luxkatana 61 — 3y
0
Okay. robloxtitanic584 92 — 3y
Ad

Answer this question