Please help me on this code, which first works then doesnt work again
SPS_Limit = 10
CitationAmount = 50
script.Parent.Transparency = 1
script.Parent.Touched:Connect(function(Part)
if Part:IsA("VehicleSeat") and Part.Occupant then
local Player = game.Players:GetPlayerFromCharacter(Part.Occupant.Parent)
local GotSpeed = math.floor(Part.Velocity.Magnitude/2)
if not Player.PlayerGui:FindFirstChild("Citation") and GotSpeed > SPS_Limit then
Player.leaderstats.Money.Value = Player.leaderstats.Money.Value - CitationAmount
local Citation = script.Citation:Clone()
Citation.Frame.Description.Text = "Aşırı Hız. Speed Limit: " .. SPS_Limit .. ". Your Speed: " .. GotSpeed
Citation.Parent = Player.PlayerGui
Citation.Frame.LocalScript.Disabled = false
end
end
end)
That is extremely vague, what “just works once” is it the Touched event? Are you trying to say the touched event fires once and then stops firing even though parts are touching it?
Okay I’m sensing you don’t understand what the Touched event does.
Is what you are calling a “speed limit” a BasePart?
Let me explain to you what the Touched event is.
Each BasePart in workspace has an event that will fire when any other BasePart touches it. That even is called “Touched”. It returns one argument, the part that “touched” (other part)
If you have a Part called on the ground and you have a Touched event connected to it. Then you drive over it, the event should fire.