Basically, I have a proximity prompt, when it is used, it runs this script
local ProximityPromptService = game:GetService("ProximityPromptService")
local parent = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MakeBagel = ReplicatedStorage:WaitForChild("BagelHandler")
local prox = game.Workspace.BagelCooking.ProximityPrompt
local Part = script.Parent.Parent
Part.ProximityPrompt.Triggered:Connect(function(player)
MakeBagel:FireServer()
print("hvdevevebje")
end)
as you can see, it fires a remote event, which connects to this script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MakeBagel = ReplicatedStorage:WaitForChild("BagelHandler")
local parent = script.Parent
local animation = parent:FindFirstChild("drink")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://6371082434"
local playable = true
game.Workspace.BagelCooking.ProximityPrompt.Triggered:Connect(function(player)
if playable == true then
print("hey")
local character = player.Character or player:WaitForChild("Character")
local human = character.Humanoid
local location = game.Lighting.Food
local AnimationTrack = human.Animator:LoadAnimation(Animation)
local Clone = location.Bagel:Clone()
game.Workspace.BagelCooking.ProximityPrompt.Enabled = false
AnimationTrack:Play()
playable = false
human.Parent.HumanoidRootPart.Orientation = Vector3.new(0,-180,0)
human.Parent.HumanoidRootPart.Position = Vector3.new(10.5,3,34)
human.WalkSpeed = 0
human.JumpPower = 0
wait (1.23)
Clone.Parent = character
game.Workspace.BagelCooking.ProximityPrompt.Enabled = true
playable = true
wait(1.95)
player.PlayerGui.Foods.Bagel.Visible = true
end
end)
at the end of the script, it makes a ui visable, works perfectly the first use, the ui has a text button with this script within it
local parent = script.Parent
local animation = parent:FindFirstChild("drink")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://6371121616"
local click = script.Parent.Value
local playable = true
parent.MouseButton1Click:Connect(function(player)
print("hi")
local player = game.Players.LocalPlayer
local character = player.Character
local human = character.Humanoid
local location = game.Lighting.Food
local AnimationTrack = human.Animator:LoadAnimation(Animation)
player.PlayerGui.Foods.Bagel.Visible = false
wait(.5)
AnimationTrack:Play()
playable = false
wait (1.23)
character.Bagel:Destroy()
wait(.5)
location.StrawberryCreamCheeseBagel:Clone().Parent = character
playable = true
wait(.5)
human.WalkSpeed = 16
human.JumpPower = 50
end)
it works fine the first time, but as stated earlier, if i ran this again, the 2nd script which is what is checking for the remote event breaks after changing the position of the character, doesnt make the ui visible, doesnt change the walkspeed, it just breaks
heres an example of how its supposed to work: https://gyazo.com/5d268d14f2e938ce1b747ff3e6b34291
heres an example of me using the proximity prompt again and it not working: https://gyazo.com/7217876f7d0081fd726d59c62a39662c
