Need some help with scripting!

trust me, .touched works locally and i just noticed that the OP put the local script under workspace which is why the script i sent him didnt work in the first place, I just noticed that now
and about the .Touched event, it makes more sense to use it locally since its more accurate on the client side rather than the server side, you can test that out for yourself,
if .touched didnt work for you, then you’re most likely parenting it under a service that cant execute local scripts

here’s an example of me trying it:
image

local part = workspace.Part

part.Touched:Connect(function()
	print("t")
end)

image

1 Like

I put the localScript under starterplayerscripts and not startercharacterscripts, is that why it didn’t work?
Is it because the Players service is server-side and Workspace is client-side?

no putting it under both starterplayerscripts and startercharacterscripts works fine

why didn’t it work on my side then? i used the same script for the localscript as i did with the serverscript

can u show me where the script is parented and the full script

my bad for the late reply
anyway, when testing, i put the localscript inside of starterplayerscripts, using the same section of code that you had created for him


 (script.Parent.Touched:Connect(function(hit)
    local hit_player = hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) -- get the player that hit
	if  hit.Parent:FindFirstChild("Humanoid") and hit_player == game.Players.LocalPlayer  then
		script.Parent.Transparency = 1
		script.Parent.CanCollide = false
	end
end