Script help remote events

I am doing when you touched the part you can claim. When you touchended can’t claim the part.

and here script. Its local script in a part.

What is the issue here? Are the events not firing, or not being received?

not being received. I again looked local-script again and i don’t know where is the problem?

1 Like

Mind if I have a look at the server sided script?

you mean this? i am right?

1 Like

I just wanted to check something with the script that receives the event;
it will be whatever is in ServerScriptService/Workspace most of the time.

I’ve had this issue before and depending on a few things I might be able to fix it, it’s usually an argument it sends over without telling you.

you can’t run localscripts inside workspace, use a regular script, and why are you using a localscript, if you want to fire to the server, use a BindableEvent inside of a remote event, which allows server-to-server communication

2 Likes

Thank you finally i can :slight_smile:

In bindable event, it’s .Event and not .OnServerEvent and instead of calling :FireServer(), you have to call Fire() which doesn’t give the player as the first argument

Oh dang I didn’t look at the explorer-

do exactly what he suggested and use a bindable event. Send over something like this:

local ClaimBind = --define the event
local ClaimStopBind = --define the event

HouseBlock.Touched:Connect(function(hit)
    if not hit.Parent:FindFirstChild("Humanoid") then return end
    ClaimBind:Fire(hit.Parent.Name)
    HouseBlock.TouchEnded:Connect(function(hitEnded)  --// This is within the same block to allow the scropt to check if the player is the same as the one who triggered .Touched
        if hitEnded == hit then
            ClaimStopBind:Fire(hitEnded)
        end
    end)
end)

it’s not a good idea to put TouchEnded inside the touched event,

Personally won’t use TouchEnded because it isn’t that great

and also the code shouldn’t be in a localscript

1 Like

If the part is a large space, like an entire plot, Region3 might be useful I guess?