Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Give cash when touched?

Changed orginale script! Because i needs ServerScriptService and not workspace. Do you guys help me to fix it?

local ting = 0 

function onTouched(hit)
	if ting == 0 then 
	ting = 1 
	check = hit.Parent:FindFirstChild("Humanoid") 

	if check ~= nil then 

		local user = game.Players:GetPlayerFromCharacter(hit.Parent) 
		local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) 

		if cashmoney ~= nil then  
		cashmoney.Value = cashmoney.Value + 250
		end

	end

	ting = 0 
	end
end

script.Parent.Touched:connect(onTouched) 

1 answer

✓ Accepted answer

Line 11 - You use a nil value Change the 'player' to 'user' in line 11

1 comment

0

Thanks :)

This discussion is preserved as it was. New answers, comments, and votes are closed.