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

The localscript works in roblox solo mode and not in game/server?

Asked by 6 years ago
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
script.PlayerName.Value = game.Players.LocalPlayer.Name
Mouse.KeyDown:connect(function(Key)
    if Key:byte() == 32 then
        if Player.Character.Parent ~= game.Workspace then
            for _, descendant in    pairs(game.Workspace.FlightModel:GetDescendants())do
                if descendant.Name == script.PlayerName.Value then
                    descendant.Parent = game.Workspace
                end
            end
        end
    end 
end)

1 answer

Log in to vote
2
Answered by 6 years ago

This is because you scriping doesn't include remoteEvents. RemoteEvents help tranfer data from server to client or client to server. We need to use the Event FireServer. Which will fire your script into the Server which well then be read and be fire into the client aka your game. This allows everyone to see whats going on in game. Here is a youtube video on the fowllowing. if you don't like Remote event you could go into your workspace and turn it off. But if will allow players to hack in your game. Hope i helped :)

0
Quick Question, It doesn't even work in the client in game but works in roblox studio it the tutorial still going to help? FirezoneGamez 155 — 6y
0
This tutoraial will help. GGButNO_RE 61 — 6y
Ad

Answer this question