You could have both the client and the server script as backup.
You won’t get past a delay from the server easily as the client has to wait for the server to recognise a collision and spend time relaying that information back to the client that must now teleport.
.Touched events fired with client owned parts are no different than localscripts. Clients can destroy the TouchTransmitter easily.
I’m pretty sure they both print at the same time because both conditions are met.
This is printed because the part is touched.
This is also valid. If plr is not equal to nil, then print. When you touch the part plr is not equal to nil.
That is true, but if you were to actually look at the gif, it doesn’t print UNTIL I stop moving at all. That is not normal.
.Touched is often unreliable, which is why I don’t really use it nowadays. You’re better off just either using magnitude to see if the player got close to the part, and is almost touching it, or Region3.
I suggest using Zone+ module by ForeverHD for handling touchevents.
I use while true do
for .Touched
events. (Not always)
also you can use .TouchEnded
.
But I don’t like using .Touched
events anymore. It’s unstable and not reliable.
I prefer .magnitude
.
An exploiter deleting a script that allows basic character teleporting is the least of your concerns, they can teleport themselves to anywhere if done correctly.
@TalonMidnight That is true, but I am talking about that there seems to be a bug with Roblox’s LUA.
@ANDROHERSEY00 that is bad for memory.
@FastAsFlash_Dev I’ve used that before and I am using it but I just need a simple .Touched event to work like normal.
There just seems to be a problem with the event registering, maybe a recent update broke it a bit. BECAUSE:
When I move around on the part, nothing happens
BUT
when I stop moving then it works.
This might not be ideal, but you can go through the part’s touching parts (using GetTouchingParts) in a loop and if any of the touching parts is a player then teleport them.
while wait() do
local Parts = script.Parent.Ground:GetTouchingParts()
for _, Part in pairs(Parts) do
local plr = game.Players:GetPlayerFromCharacter(Part.Parent)
if plr then
plr.Character:SetPrimaryPartCFrame(game.Workspace.Elevator.TeleportPart.CFrame)
end
end
end
Did you try making the lava uncollidable? IIRC the Touched event only picks up intersection of parts but not surface collision.
That shouldn’t be happening even if the touch event is usaually unreliable. This happened to me once because my position on the server was different from my position on the client when I teleported the HumanoidRootPart by position instead of CFrame. Try checking on the server if the position is same as the client.
script.Parent.Ground.Touched:Connect(function(hit)
print("Ground touched.")
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
print("Player is not nil")
plr.Character:SetPrimaryPartCFrame(game.Workspace.Elevator.TeleportPart.CFrame)
end
end)
I think I will report this to Roblox, thanks for all the support.
Instead of using a touched event use ray casting. Have a ray constantly firing down from the player to see if it hits your part. If it hits the required part, fire a remote event. You will have to set up a denounce system for this to work properly.
That is a very bad solution and I am not going to use it. Like I said before, this topic is closed. I am going to report the bug to Roblox.
Then you should use .magnitude
.
I don’t believe this is a bug, it’s likely that it’s due to your animations. You should try using a slightly bigger (invisible, if you so desire) part that is not CanCollide for detecting when a player touches the ground as your character will sink into the part, so your animations won’t keep you slightly above the brick (and technically not touching it.)
I’d also recommending doing the detection on the client, and then telling the server that the player hit the ground, as it’ll be more accurate.
The network ownership is already nil, and I already said I will report this to Roblox.