this has really been pissing me off ive tried to get this stupid thing to work for an hour and i dont know why it wont. Ive tried like everything and nothing works.
if anyone knows why please tell me whats wrong with it
01 | script.Parent.Touched:Connect( function (hit) |
02 | local player = hit.Parent |
03 | local playerp = game.Players:FindFirstChild(player.Name) |
04 | if playerp then |
05 | if playerp = = script.Parent.Owner.Value then |
06 | game:GetService( "ReplicatedStorage" ).RemoteEvents.Workplace 1 JobEvent:FireClient(player) |
07 | else |
08 | print "player does not own" |
09 | end |
10 | else |
11 | print "no player found" |
12 | end |
13 | end ) |
14 | script.Parent.TouchEnded:Connect( function (hit) |
15 | local player = hit.Parent |
i decided to move it all local to the player instead of a remote event and it works just fine now.
For printing you gotta do
1 | print ( "diwn aaodn ad " ) |
Use () on your strings..
I think there is no issue with the script except the printing part.
Here is the print syntax you must use print(int, object.. ext)
or print("STRING")
So your code should be written like that:
01 | script.Parent.Touched:Connect( function (hit) |
02 | local player = hit.Parent |
03 | local playerp = game.Players:FindFirstChild(player.Name) |
04 | if playerp then |
05 | if playerp = = script.Parent.Owner.Value then |
06 | game:GetService( "ReplicatedStorage" ).RemoteEvents.Workplace 1 JobEvent:FireClient(player) |
07 | else |
08 | print ( "player does not own" ) |
09 | end |
10 | else |
11 | print ( "no player found" ) |
12 | end |
13 | end ) |
14 | script.Parent.TouchEnded:Connect( function (hit) |
15 | local player = hit.Parent |