Title may sound complicated but I will explain.
I am making a game currently, and inside this game I have a coin system and levels.
When you reach a certain amount of coins, your level increases.
Now, say if you reached level 1, I want a teleport that works only for people who have level 1.
So, if I have a Level screen GUI and it says 1 (to represent level 1), then I want to make the teleporter (which teleports to the level 1 section) only accessible for those people who have a value of 1 for the Level Screen GUI.
But I am using this universal local script to include the majority of my scripting for the game in.
The problem is, I am trying to use this universal local script which should allow me to edit the teleporter from that localscript, but then there's a problem.
It does not work for the localscript, but if I try and disable the part inside its own server script, it works.
(I am disabling the part to test)
Now, I've put a variable for the teleporter part inside of the universal localscript, so theoretically I should be able to disable it inside this localscript.
But that's not the case, it wont allow me to disable the part from the universal localscript, only its own teleporter server script.
Here is the universalscript:
local part = game.Workspace.green
local tele1 = game.Workspace.Part1
local player = game.Players.LocalPlayer
local balancenum = game.Players.LocalPlayer.PlayerGui.softwaregui.Frame.BalanceNumber
local guiframe = game.Players.LocalPlayer.PlayerGui.softwaregui.Frame
local levelnum = game.Players.LocalPlayer.PlayerGui.softwaregui.Frame.LevelNumber
local value = game.Players.LocalPlayer.PlayerGui.softwaregui.Frame.Value
local p = Instance.new("Part")
part.Touched:Connect(function(hit)
local p = Instance.new("Part")
if p then
balancenum.Text = value.Value
value.Value = value.Value + 10
end
if value.Value >= 1000 then
levelnum.Text = levelnum.Text + 1
end
if levelnum.Text >= "1" then
levelnum.Text = "1"
end
if value.Value >= 2000 then
levelnum.Text = levelnum.Text + 1
end
if levelnum.Text >= "2" then
levelnum.Text = "2"
end
------Teleports
tele1 = true
tele1.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
tele1 = false
end
end)
end)

3 comments
Game stuff like this should be handled in a server script. You also can't add an int and a string together. You could use tostring() for conversion if needed.
yes
LocalScript.Variable.Disabled = false