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

Why do these not work?

Asked by
IcyEvil 260 Moderation Voter
10 years ago

These are just some scripts im practicing with to get used to Local Scripts Both Connect to each other.

here is script 1.

local p = game.Players.LocalPlayer
while wait() do
    if p.Name == "Player1" then
        local x = game.ServerScriptService.LocalScript
        n = x:Clone()
        n.Parent = p
    end
end

Here is the second one

local p = game.Players.LocalPlayer
local t = p.StarterGear

local x = game.ServerStorage.Gun

m = x:Clone()
m.Parent = t
0
Are you getting any output? What are you expecting to happen? Is anything happening at all? adark 5487 — 10y

1 answer

Log in to vote
3
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

LocalScripts don't have access to the ServerScriptService or the ServerStorage service.

Use ReplicatedStorage instead. Things in here are replicated to clients -- meaning LocalScripts have access to the objects on the client's copy of the world.

Ad

Answer this question