Hi,
I got a object value and i want when player touches a brick this value will become nil
i tryed something like this:
ObjectValue.Value = nil
but value didnt changed and i don’t have any errors in output. How to make this value become empty when i touch a brick?
1 Like
un1ND3X
(ice)
May 1, 2020, 4:42pm
#2
if you want to ‘reset’ the value then change it to 0.
If you want to remove the value instance entirely then do
ObjectValue:Destroy()
and when all references to it are gone, it will be GCed.
this value thing to do support a number values
Just set it to zero, unless it is supposed to be text in the game then you need quotation marks.
NilFloat
(NilFloat)
May 1, 2020, 4:46pm
#6
You have to clear the field to set it to nil by clicking X that appears when you click the field.
i got a object value that says which tool are equipped and i want when player touches a brick it will clear the equipped value (object value)
ShkatulkaGames:
ObjectValue.Value = nil
This is correct. Are you sure it’s running?
1 Like
derpy_dog
(derpy_dog)
May 1, 2020, 4:49pm
#10
if it was running while you were editing the script you probably need to stop it then run again.
everything is good but its do not clear the value
also heres script:
local Players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
local character = hit.Parent
local player = Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
character:FindFirstChild("Humanoid"):UnequipTools()
local hum = character:FindFirstChild("Humanoid")
hum.WalkSpeed = 0
hum.JumpPower = 0
player.PlayerGui.GUI.Gear.Handler.Equipped.Value = nil
player.PlayerGui.GUI.Gear.Frame.Button.Equip.Text = "Equip"
end)
NilFloat
(NilFloat)
May 1, 2020, 4:58pm
#12
I just tried to run your code in local script and it works when I run your code. You will probably have to use RemoteEvents.
1 Like