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

Why does this LocalScript only function once?

Asked by 9 years ago
wait()
local player = game.Players.LocalPlayer

local replicatedstorage = game:GetService("ReplicatedStorage")
local roundtag = replicatedstorage:WaitForChild("RoundTag")
local lighting = game:GetService("Lighting")
local classes = lighting:WaitForChild("Classes")
local laser = classes:WaitForChild("Laser")
local rocket = classes:WaitForChild("Rocket")

roundtag.Changed:connect(function()
    if roundtag.Value == true then  
        if player.Class.Value == "Laser" then
            player.StarterGear:ClearAllChildren()
            local weapon = laser.Phaser
            weapon:Clone().Parent = player.Backpack
            weapon:Clone().Parent = player.StarterGear
        elseif player.Class.Value == "Rocket" then
            player.StarterGear:ClearAllChildren()
            local weapon = rocket.Launcher
            weapon:Clone().Parent = player.Backpack
            weapon:Clone().Parent = player.StarterGear
        end
    else

    end
end)

How come this only works once? it gives the players guns on the first round but every round after it does nothing

0
I would recommand putting this script in ServerStorage with the script disabled and then use :Clone(), once the script is cloned re-parent the cloned script to the players backpack. MessorAdmin 598 — 9y
0
Woops I ment not disabled.. So yea make sure this script is NOT disabled :P MessorAdmin 598 — 9y
0
so wait, put this whole script in serverstorage, and disable it, then in the main game script clone it to the players backpack? NinjoOnline 1146 — 9y
0
I managed to get it to clone into starterpack, and it goes into the players backpack, but it doesnt give the guns? NinjoOnline 1146 — 9y
0
nvm got it working thanks :D NinjoOnline 1146 — 9y

Answer this question