local Player = script.Parent.Parent.Parent.Parent.Parent local Per = Player:WaitForChild("Coins") -- The player file Player:WaitForChild("Ready") -- Waits until 'Ready' appears if script.Parent.Position = UDim2.new{0.235, 0, 0.2, 0} then Player.Coins.Value = Player.Coins.Value + 5 end
= is setting something
== is comparing
if script.Parent.Position == UDim2.new{0.235, 0, 0.2, 0} then
You aren't setting the Position of script.Parent you're checking it so you would use ==
Easy fix, just use a comparison instead of a specifier. This is what it should look like:
local Player = script.Parent.Parent.Parent.Parent.Parent local Per = Player:WaitForChild("Coins") -- The player file Player:WaitForChild("Ready") -- Waits until 'Ready' appears if script.Parent.Position == UDim2.new{0.235, 0, 0.2, 0} then Player.Coins.Value = Player.Coins.Value + 5 end
If you dont know what comparisions are, heres a link to the forum that shows what they are.
Simple explanation: http://wiki.roblox.com/index.php?title=Conditional_statement Detailed one: http://wiki.roblox.com/index.php?title=Operator#Relational
that means that it is an error. On line 5 instead of saying
if script.PArent.Position = UDim2.new() then
replace the = with == so it should be
if script.Parent.Position == UDim2.new{0.235, 0, 0.2, 0} then
when you use == you are basically returning a bool value. Its saying if that statement is true/false then
=
is for setting a value.
local a = "hello"
==
is for comparing values.
local a = "hello" if a == "hello" then --Your code here end
Locked by alphawolvess, Necrorave, Tigerism, and M39a9am3R
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?