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

ServerScript not creating ObjectValue?

Asked by 6 years ago
local plr = script.Parent
local weapons = plr.plrData.ownedWeapons
weapons.ChildAdded:Connect(function(newwep)
    if newwep:IsA("Tool") then
        local id = newwep:FindFirstChild("ID")
        local val = Instance.new("ObjectValue",plr)
        val.Name = "PATH_"..id
        val.Value = newwep
    end
end)

Why isn't this ServerScript creating the ObjectValue? It is placed in a Player object. The script is not disabled. If you want the script that clones it into the Player, here you go:

game.Players.PlayerAdded:Connect(function(nplr)
    game.ServerStorage.fixInv:Clone().Parent = nplr
    nplr.fixInv.Disabled = false
end)
0
scripts don't run in the player object I think Vulkarin 581 — 6y
0
^ Yeah, put your script in ServerScriptService or ReplicatedStorage. exxtremestuffs 380 — 6y

Answer this question