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)
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.