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

A Script That Runs In Studio But Not On Roblox Servers Can Someone Help Me Fix This Script?

Asked by 7 years ago
Edited 7 years ago

I Am Working A Roblox RPG Game And I Have A Script That Works In Roblox Studio But Not In The Normal Roblox Server. Can Someone Fix This I Have No Clue What Is Wrong With It.(By The Way It Is A Script Not A Local Script Encase That Has To Do With The Problem)

Here Is The Script

player = game.Players.LocalPlayer

local Enabled = false

function UpdateInventory() if Enabled == false then Enabled = true script.Parent.Frame.Visible = true script.Parent.Frame.CanvasSize = UDim2.new(0,0,0,20#player.Backpack:children()) script.Parent.Frame:ClearAllChildren() for i,v in pairs(player.Backpack:GetChildren()) do Obj1 = Instance.new('TextButton',script.Parent.Frame) Obj1.Size = UDim2.new(1,-12,0,20) Obj1.Position = UDim2.new(0,0,0,20i-20) Obj1.BackgroundTransparency = 1 Obj1.FontSize = 'Size24' Obj1.Text = v.Name Obj1.Font = 'SourceSansBold' Obj1.TextColor3 = Color3.new(255,255,255) Obj1.TextXAlignment = 'Left' Obj1.MouseButton1Down:connect(function() player.Character.Humanoid:UnequipTools() player.Character.Humanoid:EquipTool(v) end) end else Enabled = false script.Parent.Frame.Visible = false end end

script.Parent.InvenButton.MouseButton1Down:connect(function() UpdateInventory() end)

player.Backpack.Changed:connect(function() if Enabled == false then Enabled = true UpdateInventory() end if Enabled == true then Enabled = false UpdateInventory() end end)

I Have Been Told To Use Remote Events To Fix It But I Have No Clue How Can Someone Help Me. Thank You For Reading This :P

0
Please use a code block or no one is going to be able to help you. User#11440 120 — 7y
0
player = game.Players.LocalPlayer only works in local script hence the LOCALPLAYER. LostPast 253 — 7y
0
Please use a code block. I won't read this without a code block but I can tell you this. Most problems like this are caused by, (1): Using a serverscript when you should use a local script (2): Attempting to access the local player in a server script (3): Attempting to access any local part of a game from a server script. AZDev 590 — 7y

Answer this question