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

Why does this only work in Test mode? [ADDED SCRIPT :D]

Asked by 9 years ago

Hi, I'm making a One Piece game- a Anime-based game. And I already made the Data. Now every time someone spawns into my game, a GUI will pop up on their screen. My problem is that it only works in ROBLOX studio. i.e, when I'm testing it. It even changes the StringValue in the Data. And it's supposed to clone a tool in the lighting, and deliver it to my Backpack. As I said, it works fine in Studio. It's when I play the game in a server.

KS = script.Parent
ScreenGui = script.Parent.Parent
StarterGui = script.Parent.Parent.Parent
local Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
function DataClone(mouse)
    LKS = game.Lighting.KnightsSword:clone()
    LKS.Parent = Player.Backpack
    Player.Data.Weapon.Value = "KS"
dope = ScreenGui:GetChildren()
for i, v in pairs(dope) do
    v:Remove()
end
end
script.Parent.MouseButton1Click:connect(DataClone)

2 answers

Log in to vote
1
Answered by 9 years ago

You need to show us the script mate.

Ad
Log in to vote
1
Answered by 9 years ago

Easy,

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse has to be local as well. Also put wait(.05) at the very top to make sure the local scripts doesn't load faster then the respawn. Due to the fact local scripts work faster then serverside scripts.

Answer this question